<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="UTF-8" import="java.text.SimpleDateFormat"
	import="java.util.Date" import="java.util.List"%>
<%@include file="/lib/common/basedir.jsp"%>
<!DOCTYPE html>
<html lang="en">
<head>
<%@include file="/lib/common/headerResource.html"%>
<!--sidebar-->
<link href="<%=basedir%>/lib/css/sidebar.css" rel="stylesheet">

<!-- bootstrap-select -->
<link
	href="<%=basedir%>/lib/util/bootstrap-select/bootstrap-select.min.css"
	rel="stylesheet">

<!--date-picker-->
<link
	href="<%=basedir%>/lib/util/datetimepicker/bootstrap-datetimepicker.min.css"
	rel="stylesheet">

<title>integral balance</title>

<style>
.content {
	margin-top: 1.5em;
}

.title {
	font-size: 1.4em;
}

.line {
	margin-bottom: 2em;
}

.add {
	margin-top: 0.5em;
}
</style>
</head>
<body>
	<div class="container-fluid">
		<div class="row">
			<!--左侧导航-->
			<div class="col-sm-3 col-md-2 sidebar">
				<%@include file="../sidebar.jsp"%>
			</div>
			<!--右面板-->
			<div
				class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 rightPanel">
				<div class="row">
					<h2 class="page-header col-md-11">销售计划修改</h2>
				</div>

				<form id="form" class="form-horizontal content" method="post"
					action="<%=basedir %>/employeeLeader/salesPlan">
					<%
						String planId=(String)request.getAttribute("planId");
						String[] date_storeId=planId.split("_");
						long date=Long.parseLong(date_storeId[0]);
					%>


					<div class="form-group line">
						<span class="title col-md-1">时间</span>
						<span class="title col-md-2"><%=new SimpleDateFormat("yyyy-MM-dd").format(new Date(date)) %></span>
						<input type="hidden" name="date" value="<%=date%>">
					</div>
					
					



					<div class="form-group line">
						<span class="title col-md-1">商品</span>
						<div class="col-md-3">
							<select id="lunchBegins" name="commodity" class="selectpicker"
								data-live-search="true" data-live-search-style="begins"
								title="商品" >
								
								<%
									@SuppressWarnings("unchecked")
									List<String> commodities=(List<String>)request.getAttribute("commodities");
									String options="";
									if(commodities!=null){
										for(String s:commodities){
											options+="<option>"+s+"</option>";
										}
										}
								%>
								<%=options %>
							
							</select>

						</div>
						<div class="col-md-2">
							<input type="text" name="price" class="form-control" id="end1"
								placeholder="单价">
						</div>
						<div class="col-md-2">
							<input type="text" name="num" class="form-control" id="end1"
								placeholder="数量">
						</div>
						<span class="glyphicon glyphicon-plus add add0" aria-hidden="true"
							role="button"></span>
					</div>

					<div class="row separator0">
						<hr class="col-md-10" />
					</div>

					<div class="form-group line save">
						<div class="col-md-2 ">
							<button type="submit"
								class="btn btn-default  btn-block submitBtn save">提交</button>
						</div>
					</div>
					
					
				</form>
			</div>
		</div>
	</div>

	<!-- jquery and bootstrap js -->
	<%@include file="/lib/common/footerResource.html"%>

	<script
		src="<%=basedir%>/lib/util/bootstrap-select/bootstrap-select.js"></script>

	<script
		src="<%=basedir%>/lib/util/datetimepicker/bootstrap-datetimepicker.min.js"></script>

	<script>
		$('.form_date').datetimepicker({
			weekStart : 1,
			todayBtn : 1,
			autoclose : 1,
			todayHighlight : 1,
			startView : 2,
			minView : 2,
			forceParse : 0,
			pickerPosition : "bottom-left"
		}).on('changeDate', function() {
			//window.location = "http://www.baidu.com/$('#dtp_input2').val()";
			//jQuery.noConflict();
			//alert(jQuery('#dtp_input2').val());
		});

		function add0() {
			$('.separator0')
					.before(
							'<div class="form-group line"><span class="title col-md-1">商品</span><div class="col-md-3"><select id="lunchBegins" name="commodity" class="selectpicker" data-live-search="true" data-live-search-style="begins" title="商品">'+
							'<%=options %>'
							+'</select></div><div class="col-md-2"><input type="text" name="price" class="form-control" id="end1" placeholder="单价"></div><div class="col-md-2"><input type="text" name="num" class="form-control" id="end1" placeholder="数量"></div><span class="glyphicon glyphicon-plus add add0" aria-hidden="true" role="button"></span></div>');
		}

		$(document).ready(function() {
			$("body").on("click", ".add0", function() {
				$('.add0').hide();
				add0();
				$('.selectpicker').selectpicker();
			});
		});
	</script>

</body>
</html>